package ai.mspbots.poc.db.entity;

import ai.mspbots.poc.dto.SearchHistoryLogDTO;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName search_history_log
 */
@TableName(value ="poc_search_history_log")
@Data
public class SearchHistoryLog implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 查询关键词
     */
    @TableField(value = "search_text")
    private String searchText;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public SearchHistoryLog() {

    }

    public SearchHistoryLog(SearchHistoryLogDTO searchHistoryLogDTO) {
        this.searchText = searchHistoryLogDTO.getSearchText();
        this.createTime = new Date();
    }
}